package jonaPad;
import java.awt.event.*;

public class GTimer extends Thread {
  private int delay;
  private ActionListener l;

  public GTimer(int delay, ActionListener l){
      setDelay(delay);
      this.l = l;
  }
  
  public synchronized void run() {
      while (true) {
          l.actionPerformed(new ActionEvent(this, 0, null));
          try {
              Thread.sleep(delay);
          }
          catch (InterruptedException error) {
              System.err.println("Thread interrupted" + error.toString());
          }
      }
  }

  public void setDelay(int delay) {
	      this.delay = delay;
	}

}